<template>
    <form action="" style="width: 100%;height: 100%;" v-loading="loading" element-loading-text="拼命加载中"
        element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)">
        <div style="width: 100%;height: 100%;">
            <div style="width: 100%;height: 9%;display: flex;align-items: center;">
                <div class="scrollable-div" ref="scrollableDiv" @wheel="scrollHorizontally">
                    <el-radio v-for="(item,index) in allForm" :key="index" v-model="radio1" :label="item.label" border>{{
                        returnTitle(index) }}</el-radio>
                </div>



                <div style="margin-left: auto;display: flex;gap:15px;">
                    <div style="display: flex; align-items: center; justify-content: center; width: 28px; "
                        class="btn_width">
                        <el-button style="width: 28px;height: 28px;" icon="el-icon-refresh-right"
                            @click="reNewDataAction"></el-button>
                    </div>
                    <div class="btn_second">
                        <el-popover placement="top-start" title="标题" width="200" trigger="hover" content="新增一条管网至主控阀">
                            <el-button slot="reference" @click="add" icon="el-icon-plus">新增</el-button>
                        </el-popover>
                    </div>
                    <div class="btn_three">
                        <el-popover placement="top-start" title="标题" width="200" trigger="hover" content="删除所有选中的管网至主控阀">
                            <el-button slot="reference" @click="remove" icon="el-icon-delete">删除</el-button>
                        </el-popover>
                    </div>

                </div>
            </div>
            <div
                style="height: 84.5%;position: relative; overflow: auto;padding: 10px;border: 1px solid rgb(221, 228, 239);">


                <div style="display: flex;  align-items: center; width: 100%;">
                    <div class="before"></div>
                    <div>主控阀至调压设施</div>
                    <div class="smallTilte">
                <div>根据图纸，从主控阀的位置沿着管线直至调压设施，一路观察地质和周边环境。</div>
                </div>
                    <div style="display: flex;margin-left: auto;align-items: center;gap: 15px;width: 40%;">
                        <div >备注</div>
                        <el-input v-model="allForm[radio1].data.notes.content" placeholder="请输入" style="width: 90%;"></el-input>


                    </div>
                </div>

             
            <div class="contentPadding" style="width: 100%; display: flex; flex-wrap: wrap;gap: 1%;">
                <div style="border-radius: 4px;border: 1px solid #DCDFE6;margin-top: 20px;width: 19.2%;height: 202px;" v-for="(item, index) in allForm[radio1].data.netStillMainControllValueOne" :key="index">
                    <div style="display: flex; padding: 10px;padding-left: 30px;align-items: center;">
                                <div style="width: 4px;height: 15px;background-color: rgb(24, 144, 255);margin-right: 5px;border-radius: 2px;">
                                </div>
                                <div>{{ item.title }}</div>
                            </div>
                            <div style="width: 100%;height: 0.5px;background-color: rgb(220, 223, 230);"></div>
                            <div style="width: 100%;justify-content: center;padding: 20px;padding-left: 33px; ">
                          
                            <div
                                style="display: flex;gap:25px;text-align: center;">
                          
                                <div style="width: 120px;height: 120px;position: relative;" class="demo-image__error">
                                    <el-image v-show="netStillMainControllValueOne[index].imageAddress.length>0" style="width: 100%;height: 100%;"
                                            :src="netStillMainControllValueOne[index].imageAddress[0]"
                                            :preview-src-list="netStillMainControllValueOne[index].imageAddress">
                                            <div slot="error" class="image-slot">
                                                <img src="../../assets/images/stageIcon/加载失败.jpeg" alt=""
                                                    style="width: 100%;height: 100%;">
                                            </div>
                                        </el-image>
                                        <img v-show="netStillMainControllValueOne[index].imageAddress.length==0" src="../../assets/images/stageIcon/暂无图片.png" alt="" style="width: 100%;height: 100%;">
                                        <div class="imageSample" v-show="netStillMainControllValueOne[index].imageAddress.length>0">范例图</div>
                                </div>
                                <div style="width: 120px;height: 120px;">
                                    <image-look-fourth-vue :upAddress="item.upAddress" :imageData="item.imageData"
                                            :projectInfo="projectInfo" :id="stageSurveyInnerMppnList[radio1].id"
                                            :dictName="item.dictName" :sampleImageAll="netStillMainControllValueOne"
                                            :imageIndex="index" :flieName="item.title"></image-look-fourth-vue>

                                </div>
                            </div>
                        </div>
                </div>
          
            
        </div>
                <div style="display: flex;  align-items: center;margin-top: 30px;">
                    <div class="before"></div>
                    <div>燃气中压管网信息</div>
                    <div style="display: flex;font-size: 14px;color: rgb(144, 147, 163);">

                    </div>
                </div>
                <div class="titleStyle">
                    <div class="inputHorizon" v-for="item in allForm[radio1].data.energyMidNetInformation" :key="item.id">
                        <div style="width: 112px;text-align: right;margin-right: 20px;">{{ item.name }}</div>
                        <div style="width:56%;" v-if="item.componentType == false">
                            <el-select v-model="item.content" placeholder="请选择" style="width: 100%;" clearable>
                                <el-option v-for="items in item.data" :key="items.id" :label="items.name" :value="items.id">
                                </el-option>
                            </el-select>
                        </div>

                        <el-input v-if="item.componentType == true" v-model="item.content" :placeholder="item.placeholder"
                            style="width: 56%;" @input="restrictNumericInput(item)"></el-input>

                    </div>
                </div>
               
                <div class="contentPadding" style="width: 100%; display: flex; flex-wrap: wrap;gap: 1%;">
                <div style="border-radius: 4px;border: 1px solid #DCDFE6;margin-top: 20px;width: 19.2%;height: 202px;" v-for="(item, index) in allForm[radio1].data.energyMidPressureNetInformation" :key="index">
                    <div style="display: flex; padding: 10px;padding-left: 30px;align-items: center;">
                                <div style="width: 4px;height: 15px;background-color: rgb(24, 144, 255);margin-right: 5px;border-radius: 2px;">
                                </div>
                                <div>{{ item.title }}</div>
                            </div>
                            <div style="width: 100%;height: 0.5px;background-color: rgb(220, 223, 230);"></div>
                            <div style="width: 100%;justify-content: center;padding: 20px;padding-left: 33px; ">
                          
                            <div
                                style="display: flex;gap:25px;text-align: center;">
                          
                                <div style="width: 100%;height: 120px;position: relative;" class="demo-image__error">
                                    <el-image v-show="energyMidPressureNetInformation[index].imageAddress.length>0" style="width: 100%;height: 100%;"
                                            :src="energyMidPressureNetInformation[index].imageAddress[0]"
                                            :preview-src-list="energyMidPressureNetInformation[index].imageAddress.imageAddress">
                                            <div slot="error" class="image-slot">
                                                <img src="../../assets/images/stageIcon/加载失败.jpeg" alt=""
                                                    style="width: 100%;height: 100%;">
                                            </div>
                                        </el-image>
                                        <img v-show="energyMidPressureNetInformation[index].imageAddress.length==0" src="../../assets/images/stageIcon/暂无图片.png" alt="" style="width: 100%;height: 100%;">
                                        <div class="imageSample" v-show="energyMidPressureNetInformation[index].imageAddress.length>0">范例图</div>
                                </div>
                                <div style="width: 100%;height: 120px;">
                                    <image-look-fourth-vue :upAddress="item.upAddress" :imageData="item.imageData"
                                            :projectInfo="projectInfo" :id="stageSurveyInnerMppnList[radio1].id"
                                            :dictName="item.dictName" :sampleImageAll="energyMidPressureNetInformation"
                                            :imageIndex="index" :flieName="item.title"></image-look-fourth-vue>

                                </div>
                            </div>
                        </div>
                </div>
          
            
        </div>
                <div style="display: flex;  align-items: center;margin-top: 30px;">
                    <div class="before"></div>
                    <div>燃气管线两边10米内的安全带信息</div>
                    <div style="display: flex;font-size: 14px;color: rgb(144, 147, 163);">

                    </div>
                </div>
                <div class="titleStyle">
                    <div class="inputHorizon"
                        v-for="item in allForm[radio1].data.energyPipeLineSideSaftyInformationWithinTenMeter"
                        :key="item.id">
                        <div style="width: 112px;text-align: right;margin-right: 20px;">{{ item.name }}</div>
                        <div style="width:56%;" v-if="item.componentType == false">
                            <el-select v-model="item.content" placeholder="请选择" style="width: 100%;" clearable>
                                <el-option v-for="items in item.data" :key="items.id" :label="items.name" :value="items.id">
                                </el-option>
                            </el-select>
                        </div>
                        
                        <el-input v-if="item.componentType == true" v-model="item.content" :placeholder="item.placeholder"
                            style="width: 56%" @input="restrictNumericInput(item)"></el-input>
                       
                    </div>
                </div>
            </div>
            <el-button class="buttonStyle" @click="submit">保存</el-button>
        </div>
    </form>
</template>
<script>

import { getInfo } from "@/api/project/info";
import { getTemplateFileListApi } from "@/api/project/file";
import { updateSurveyApi } from "@/api/project/survey";
import { inMidPressurePipeNet, addInMidPressurePipeNet, removeInMidPressurePipeNet } from "@/api/project/stageApi"
import imageLookFourthVue from '../OtherOwerUseComponent/imageLookFourth.vue';
export default {
    components: {
        imageLookFourthVue
    },
    created() {
        const projectId = this.$route.params && this.$route.params.projectId;
        this.getInfo(projectId);
    },
    props: ['jsonData', 'imageData', 'projectInfo'],
    watch: {

        projectInfo: {
            handler(newData, oldData) {
                // 这里可以调用您的方法，例如:
                this.getData()
            },

        },
        jsonData: {
            handler(newData, oldData) {
            
            },
            immediate: true // 立即触发一次，以便在初始值传递时也能运行方法
        },
        imageData: {
            handler(newData, oldData) {

          

            },
            immediate: true // 立即触发一次，以便在初始值传递时也能运行方法
        },
    },
    data() {
        return {
            loading: false,
            energyMidPressureNetInformation: [
                { id: 0, title: "现场照片", imageAddress: [], dictName: 'pipingNoHiddenDangers', content: null, upAddress: '勘察范例/园区内中压管网/燃气中压管网信息/现场照片', imageData: {}, imageHint: '现场照片', description: '穿越公路描述' },
                { id: 1, title: "管道弯曲多", imageAddress: [], dictName: 'excessivePipelineBending', content: null, upAddress: '勘察范例/园区内中压管网/燃气中压管网信息/管道弯曲多', imageData: {}, imageHint: '隐患照片', description: '穿越公路描述' },
            ],
            netStillMainControllValueOne: [
                { id: 0, title: "现场照片", imageAddress: [], dictName: 'noHiddenDangers', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/现场照片', imageData: {}, imageHint: '现场照片', description: '穿越公路描述' },
                { id: 1, title: "穿越公路", imageAddress: [], dictName: 'roadCrossing', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/穿越公路', imageData: {}, imageHint: '隐患照片', description: '穿越公路描述' },
                { id: 2, title: "根系植物", imageAddress: [], dictName: 'rootPlant', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/根系植物', imageData: {}, imageHint: '隐患照片', description: '根系植物描述' },
                { id: 3, title: "沉降明显", imageAddress: [], dictName: 'significantSettlement', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/沉降明显', imageData: {}, imageHint: '隐患照片', description: '沉降明显描述' },
                { id: 4, title: "管道暴露", imageAddress: [], dictName: 'pipelineExposure', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/管道暴露', imageData: {}, imageHint: '隐患照片', description: '管道暴露描述' },
                { id: 5, title: "施工工地", imageAddress: [], dictName: 'constructionSite', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/施工工地', imageData: {}, imageHint: '隐患照片', description: '施工工地描述' },
                { id: 6, title: "车辆碾压", imageAddress: [], dictName: 'vehicleRoadCompaction', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/车辆碾压', imageData: {}, imageHint: '隐患照片', description: '车辆碾压描述' },
                { id: 7, title: "化粪池", imageAddress: [], dictName: 'inmSepticTank', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/化粪池', imageData: {}, imageHint: '隐患照片', description: '化粪池描述' },
                { id: 8, title: "电气交汇", imageAddress: [], dictName: 'electricalIntersection', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/电气交汇', imageData: {}, imageHint: '隐患照片', description: '电气交汇描述' },
                { id: 9, title: "主控阀至调压设施", imageAddress: [], dictName: 'mcvToPrf', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/主控阀至调压设施', imageData: {}, imageHint: '隐患照片', description: '主控阀至调压设施描述' },
            ],
            input: '',
            checked: '',
            //内中压的数据
            stageSurveyInnerMppnList: [],
            ///初始选中按钮
            radio1: 0,
            ///所有表单内容
            allForm: [

            ],



            imageSample: [

            ],
          
        }
    },
    name: "inMidNet",
    methods: {
        returnTitle(index){
            
            if (this.allForm[index].data.notes.content!=null){
                return this. allForm[index].data.notes.content
            }
            return '园区内中压管网'+(index+1) 
        },
        getData(){
            this.loading=true
            inMidPressurePipeNet(this.projectInfo.projectId).then(response => {
                this.loading=false
                    if (response.code == 200) {
                        this.stageSurveyInnerMppnList = response.data
                    

                        this.distrbute()
                    }
                })
        },
        reNewDataAction() {
            this.getImage('勘察范例/园区内中压管网/主控阀至调压设施', 1)
            this.getImage('勘察范例/园区内中压管网/燃气中压管网信息', 2)
            this.getData()
        },
        getInfo(projectId) {
            getInfo(projectId).then(response => {
                this.projectInfo = response.data;

            })
        },
        reNew() {
            inMidPressurePipeNet(this.projectInfo.projectId).then(response => {
                if (response.code == 200) {
                    this.stageSurveyInnerMppnList = response.data


                    this.distrbute()
                }
            })
        },
        distrbute() {
            this.allForm = []
            for (let i = 0; i < this.stageSurveyInnerMppnList.length; i++) {
                let netStillMainControllValueOne = [
                    { id: 0, title: "现场照片", imageAddress: [], dictName: 'noHiddenDangers', content: null, upAddress: '内网中压管网/主控阀至调压设施/现场照片', imageData: {}, imageHint: '现场照片', description: '穿越公路描述' },
                    { id: 1, title: "穿越公路", imageAddress: [], dictName: 'roadCrossing', content: null, upAddress: '内网中压管网/主控阀至调压设施/穿越公路', imageData: {}, imageHint: '隐患照片', description: '穿越公路描述' },
                    { id: 2, title: "根系植物", imageAddress: [], dictName: 'rootPlant', content: null, upAddress: '内网中压管网/主控阀至调压设施/根系植物', imageData: {}, imageHint: '隐患照片', description: '根系植物描述' },
                    { id: 3, title: "沉降明显", imageAddress: [], dictName: 'significantSettlement', content: null, upAddress: '内网中压管网/主控阀至调压设施/沉降明显', imageData: {}, imageHint: '隐患照片', description: '沉降明显描述' },
                    { id: 4, title: "管道暴露", imageAddress: [], dictName: 'pipelineExposure', content: null, upAddress: '内网中压管网/主控阀至调压设施/管道暴露', imageData: {}, imageHint: '隐患照片', description: '管道暴露描述' },
                    { id: 5, title: "施工工地", imageAddress: [], dictName: 'constructionSite', content: null, upAddress: '内网中压管网/主控阀至调压设施/施工工地', imageData: {}, imageHint: '隐患照片', description: '施工工地描述' },
                    { id: 6, title: "车辆碾压", imageAddress: [], dictName: 'vehicleRoadCompaction', content: null, upAddress: '内网中压管网/主控阀至调压设施/车辆碾压', imageData: {}, imageHint: '隐患照片', description: '车辆碾压描述' },
                    { id: 7, title: "化粪池", imageAddress: [], dictName: 'inmSepticTank', content: null, upAddress: '内网中压管网/主控阀至调压设施/化粪池', imageData: {}, imageHint: '隐患照片', description: '化粪池描述' },
                    { id: 8, title: "电气交汇", imageAddress: [], dictName: 'electricalIntersection', content: null, upAddress: '内网中压管网/主控阀至调压设施/电气交汇', imageData: {}, imageHint: '隐患照片', description: '电气交汇描述' },
                    { id: 9, title: "主控阀至调压设施", imageAddress: [], dictName: 'mcvToPrf', content: null, upAddress: '内网中压管网/主控阀至调压设施/主控阀至调压设施', imageData: {}, imageHint: '隐患照片', description: '主控阀至调压设施描述' },
                ]

                for (let n = 0; n < netStillMainControllValueOne.length; n++) {
                    if (netStillMainControllValueOne[n].componentType == true) {
                        netStillMainControllValueOne[n].content = this.stageSurveyInnerMppnList[i][netStillMainControllValueOne[n].dictName]
                    } else {
                        let value = this.stageSurveyInnerMppnList[i][netStillMainControllValueOne[n].dictName]
                        if (value != null && value != '') {
                            netStillMainControllValueOne[n].content = parseInt(this.stageSurveyInnerMppnList[i][netStillMainControllValueOne[n].dictName])
                        }



                    }
                }
                let energyMidNetInformation = [
                    { name: '管道长度', id: 1, componentType: true, content: null, placeholder: "请输入", dictName: 'pipeLength', isNumTypeInput: false },
                    { name: '管网分支线', id: 2, componentType: true, content: null, placeholder: "请输入(数量)", dictName: 'branchLineNumber', isNumTypeInput: true },
                    { name: '燃气阀门井', id: 3, componentType: true, content: null, placeholder: "请输入(数量)", dictName: 'gasValveWellsNumber', isNumTypeInput: true },
                    // {
                    //     name: '管道弯曲多', id: 4, componentType: false, dictName: 'excessivePipelineBending', content: null, data: [
                    //         { name: '否', id: 1 },
                    //         { name: '是', id: 2 },
                    //     ]
                    // },
                ]
                for (let n = 0; n < energyMidNetInformation.length; n++) {
                    energyMidNetInformation[n].content = this.stageSurveyInnerMppnList[i][energyMidNetInformation[n].dictName]
                }
                let energyMidPressureNetInformation = [
                    
                    { id: 1, title: "管道弯曲多", imageAddress: [], dictName: 'excessivePipelineBending', content: null, upAddress: '内网中压管网/燃气中压管网信息/管道弯曲多', imageData: {}, imageHint: '隐患照片', description: '穿越公路描述' },
                ]

                let energyPipeLineSideSaftyInformationWithinTenMeter = [
                    { name: '雨水井数', id: 1, componentType: true, content: null, placeholder: "请输入(数量)", dictName: 'catchBasin', isNumTypeInput: true },
                    { name: '污水井数', id: 2, componentType: true, content: null, placeholder: "请输入(数量)", dictName: 'bilgeWell', isNumTypeInput: true },
                    { name: '电力井数', id: 3, componentType: true, content: null, placeholder: "请输入(数量)", dictName: 'electricWell', isNumTypeInput: true },
                    { name: '有害气体雨污水井数', id: 4, componentType: true, content: null, placeholder: "请输入(数量)", dictName: 'harmfulGasCatchBasin', isNumTypeInput: true },
                    { name: '甲烷最高值', id: 5, componentType: true, content: null, placeholder: "请输入", dictName: 'methaneMax', isNumTypeInput: false },
                    { name: '硫化氢最高值', id: 6, componentType: true, content: null, placeholder: "请输入", dictName: 'hydrogenSulfideMax', isNumTypeInput: false },
                    { name: '一氧化碳最高值', id: 7, componentType: true, content: null, placeholder: "请输入", dictName: 'carbonMonoxideMax', isNumTypeInput: false },
                    { name: '燃气管道与电缆线缆平行距离', id: 8, componentType: true, content: null, placeholder: "请输入", dictName: 'parallelDistance', isNumTypeInput: false },
                    { name: '燃气管道与电缆线缆交叉点', id: 9, componentType: true, content: null, placeholder: "请输入", dictName: 'intersection', isNumTypeInput: false },
                    { name: '电缆缆线电力电压', id: 10, componentType: true, content: null, placeholder: "请输入", dictName: 'powerVoltage', isNumTypeInput: false },
                ]
                for (let n = 0; n < energyPipeLineSideSaftyInformationWithinTenMeter.length; n++) {
                    if (energyPipeLineSideSaftyInformationWithinTenMeter[n].componentType == true) {
                        energyPipeLineSideSaftyInformationWithinTenMeter[n].content = this.stageSurveyInnerMppnList[i][energyPipeLineSideSaftyInformationWithinTenMeter[n].dictName]
                    } else {
                        let value = this.stageSurveyInnerMppnList[i][energyPipeLineSideSaftyInformationWithinTenMeter[n].dictName]
                        if (value != null && value != '') {
                            energyPipeLineSideSaftyInformationWithinTenMeter[n].content = parseInt(this.stageSurveyInnerMppnList[i][energyPipeLineSideSaftyInformationWithinTenMeter[n].dictName])
                        }
                    }
                }

                let notes=
                    {dictName:'notes',placeholder:'请输入',isNumTypeInput:false,content:null}
                    notes.content=this.stageSurveyInnerMppnList[i].notes
                var dict = { data: {}, label: this.allForm.length }
                dict.data['netStillMainControllValueOne'] = netStillMainControllValueOne
                dict.data['energyMidNetInformation'] = energyMidNetInformation
                dict.data['energyMidPressureNetInformation'] = energyMidPressureNetInformation
                dict.data['energyPipeLineSideSaftyInformationWithinTenMeter'] = energyPipeLineSideSaftyInformationWithinTenMeter
                dict.data['notes'] = notes
                this.allForm.push(dict)

            }
        },
        ///删除表单操作
        remove() {
            if (this.allForm.length > 1) {
                let id = this.stageSurveyInnerMppnList[this.radio1].id
                removeInMidPressurePipeNet(id).then(response => {
                    if (response.code == 200) {
                        if (this.radio1 == this.stageSurveyInnerMppnList.length - 1) {
                            this.radio1 = this.radio1 - 1
                        }
                        this.reNew()
                    }
                })
            }
        },
        ///增加表单操作
        add() {

            let stageSurvey = { projectId: this.projectInfo.projectId }

            addInMidPressurePipeNet(stageSurvey).then(response => {
                if (response.code == 200) {

                    this.reNew()

                }
            })



        },
        scrollHorizontally(event) {
            event.preventDefault();
            const scrollAmount = event.deltaY;
            this.$refs.scrollableDiv.scrollLeft += scrollAmount;
        },
        open() {
            this.$alert('提交内网中压管网成功', '提交成功', {
                confirmButtonText: '确定',
             
            });
        },
        restrictNumericInput(item) {
            const value = item.content;

            // 使用正则表达式验证输入是否为数字
            if (!/^\d*$/.test(value)) {
                // 如果输入不是数字，则移除非数字字符
                if (item.isNumTypeInput == true) {
                    item.content = value.replace(/[^\d]/g, '');
                }

            }
        },

        submit() {
            this.loading=true
            //修改已有的
            let all = { stageSurveyInnerMppnList: [] }
            for (let i = 0; i < this.stageSurveyInnerMppnList.length; i++) {

                var stageSurvey = { projectId: this.projectInfo.projectId, id: this.stageSurveyInnerMppnList[i].id }

                //燃气中压管网信息
                for (let n = 0; n < this.allForm[i].data['energyMidNetInformation'].length; n++) {

                    if (this.allForm[i].data['energyMidNetInformation'][n].dictName != '') {
                        stageSurvey[this.allForm[i].data['energyMidNetInformation'][n].dictName] = this.allForm[i].data['energyMidNetInformation'][n].content
                    }
                }
                //燃气管线两边10米内的安全带信息
                for (let n = 0; n < this.allForm[i].data['energyPipeLineSideSaftyInformationWithinTenMeter'].length; n++) {

                    if (this.allForm[i].data['energyPipeLineSideSaftyInformationWithinTenMeter'][n].dictName != '') {
                        stageSurvey[this.allForm[i].data['energyPipeLineSideSaftyInformationWithinTenMeter'][n].dictName] = this.allForm[i].data['energyPipeLineSideSaftyInformationWithinTenMeter'][n].content
                    }
                }
                if (this.allForm[i].data['notes'].dictName!=''){
                    stageSurvey[this.allForm[i].data['notes'].dictName] = this.allForm[i].data['notes'].content
                 }

                all.stageSurveyInnerMppnList.push(stageSurvey)
            }
            updateSurveyApi(all).then(response => {
                this.loading=false
                if (response.code == 200) {
                    this.open()
                }
            })

            //提交新增的
            // let num=this.allForm.length-stageSurveyGasMcvList
            for (let i = this.stageSurveyInnerMppnList.length; i < this.allForm.length; i++) {
                var stageSurvey = { projectId: this.projectInfo.projectId }

                //主控阀
                for (let n = 0; n < this.allForm[i].data['energyMidNetInformation'].length; n++) {

                    if (this.allForm[i].data['energyMidNetInformation'][n].dictName != '') {
                        stageSurvey[this.allForm[i].data['energyMidNetInformation'][n].dictName] = this.allForm[i].data['energyMidNetInformation'][n].content
                    }
                }
                //描述
                for (let n = 0; n < this.allForm[i].data['energyPipeLineSideSaftyInformationWithinTenMeter'].length; n++) {

                    if (this.allForm[i].data['energyPipeLineSideSaftyInformationWithinTenMeter'][n].dictName != '') {
                        stageSurvey[this.allForm[i].data['energyPipeLineSideSaftyInformationWithinTenMeter'][n].dictName] = this.allForm[i].data['energyPipeLineSideSaftyInformationWithinTenMeter'][n].content
                    }
                }

                addInMidPressurePipeNet(stageSurvey).then(response => {
                    if (response.code == 200) {
                        this.open()
                    }
                })
            }

        }
        ,
        
        getImage(path, action) {
            if (action == 1) {
               let netStillMainControllValueOne= [
                { id: 0, title: "现场照片", imageAddress: [], dictName: 'noHiddenDangers', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/现场照片', imageData: {}, imageHint: '现场照片', description: '穿越公路描述' },
                { id: 1, title: "穿越公路", imageAddress: [], dictName: 'roadCrossing', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/穿越公路', imageData: {}, imageHint: '隐患照片', description: '穿越公路描述' },
                { id: 2, title: "根系植物", imageAddress: [], dictName: 'rootPlant', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/根系植物', imageData: {}, imageHint: '隐患照片', description: '根系植物描述' },
                { id: 3, title: "沉降明显", imageAddress: [], dictName: 'significantSettlement', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/沉降明显', imageData: {}, imageHint: '隐患照片', description: '沉降明显描述' },
                { id: 4, title: "管道暴露", imageAddress: [], dictName: 'pipelineExposure', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/管道暴露', imageData: {}, imageHint: '隐患照片', description: '管道暴露描述' },
                { id: 5, title: "施工工地", imageAddress: [], dictName: 'constructionSite', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/施工工地', imageData: {}, imageHint: '隐患照片', description: '施工工地描述' },
                { id: 6, title: "车辆碾压", imageAddress: [], dictName: 'vehicleRoadCompaction', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/车辆碾压', imageData: {}, imageHint: '隐患照片', description: '车辆碾压描述' },
                { id: 7, title: "化粪池", imageAddress: [], dictName: 'inmSepticTank', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/化粪池', imageData: {}, imageHint: '隐患照片', description: '化粪池描述' },
                { id: 8, title: "电气交汇", imageAddress: [], dictName: 'electricalIntersection', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/电气交汇', imageData: {}, imageHint: '隐患照片', description: '电气交汇描述' },
                { id: 9, title: "主控阀至调压设施", imageAddress: [], dictName: 'mcvToPrf', content: null, upAddress: '勘察范例/园区内中压管网/主控阀至调压设施/主控阀至调压设施', imageData: {}, imageHint: '隐患照片', description: '主控阀至调压设施描述' },
            ]
                this.netStillMainControllValueOne=netStillMainControllValueOne
                // this.netStillMainControllValueOne = netStillMainControllValueOne

                getTemplateFileListApi(path).then(response => {

                    if (response.code == 200) {

                        if (response.data.length != 0) {
                            Array.from(response.data).forEach(item => {
                                for (var i = 0; i < this.netStillMainControllValueOne.length; i++) {

                                    if (this.netStillMainControllValueOne[i].upAddress == item.fileTreePath) {

                                        Array.from(item.fileList).forEach(items => {

                                            this.netStillMainControllValueOne[i].imageAddress.push(this.$myGlobalVariable + items)
                                          
                                        })
                                    }
                                }

                            });
                        }
                    }
                    
                })
            } else if (action == 2) {
               let energyMidPressureNetInformation = [
                // { id: 0, title: "无隐患", imageAddress: [], dictName: 'pipingNoHiddenDangers', content: null, upAddress: '勘察范例/园区内中压管网/燃气中压管网信息/无隐患', imageData: {}, imageHint: '现场照片', description: '穿越公路描述' },
                { id: 1, title: "管道弯曲多", imageAddress: [], dictName: 'excessivePipelineBending', content: null, upAddress: '勘察范例/园区内中压管网/燃气中压管网信息/管道弯曲多', imageData: {}, imageHint: '隐患照片', description: '穿越公路描述' },
            ]
                this.energyMidPressureNetInformation=energyMidPressureNetInformation
                
                getTemplateFileListApi(path).then(response => {

                    if (response.code == 200) {

                        if (response.data.length != 0) {
                            Array.from(response.data).forEach(item => {
                                for (var i = 0; i < this.energyMidPressureNetInformation.length; i++) {

                                    if (this.energyMidPressureNetInformation[i].upAddress == item.fileTreePath) {

                                        Array.from(item.fileList).forEach(items => {

                                            this.energyMidPressureNetInformation[i].imageAddress.push(this.$myGlobalVariable + items)

                                        })
                                    }
                                }

                            });
                        }

                    }

                })
            }
        }
    },
    mounted() {
        this.getImage('勘察范例/园区内中压管网/主控阀至调压设施', 1)
        this.getImage('勘察范例/园区内中压管网/燃气中压管网信息', 2)
    }

}

</script>
<style></style>